package com.hk.controller;

import com.alibaba.fastjson.JSON;
import com.hk.domain.dto.SerializerDTO;
import com.hk.domain.dto.ValidateDTO;
import com.hk.service.business.chrome.ChromeDriverService;
import com.hk.utils.R;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class TestController {


    @Autowired
    private ChromeDriverService chromeDriverService;

    @ApiOperation("Validate参数校验")
    @PostMapping("validate/test")
    public R validate(@Validated @RequestBody ValidateDTO validateDTO) {
        log.info("~~~~~~~~~~");
        return R.ok();
    }


    @PostMapping("filedsSerializerTest")
    public R filedsSerializerTest(SerializerDTO serializerDTO) {
        log.info("入参数：{}", JSON.toJSONString(serializerDTO));
        return R.ok();
    }

    @ApiOperation("chrome生成pdf文件")
    @GetMapping("chrome")
    public R chrome() {
        chromeDriverService.generatePdf();
        return R.ok();
    }




}
